package com.zhichat.infrastructure.exception.http;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class CommonException extends RuntimeException {
    private static final long serialVersionUID = -6108400400972501589L;
    protected Integer code;
    protected Integer httpStatusCode = 500;
    protected Object data;

    public CommonException(String data) {
        this(606, data);
    }

    public CommonException(Integer code, Object data) {
        super();
        this.code = code;
        this.data = data;
    }

    public static final CommonException PARAMETER_COMMON_EXCEPTION = new CommonException(300, "参数异常");
    public static final CommonException DB_MODIFY_COMMON_EXCEPTION = new CommonException(301, "数据库操作失败");
    public static final CommonException MONGO_MODIFY_COMMON_EXCEPTION = new CommonException(302, "MG操作失败");
    public static final CommonException SYS_COMMON_EXCEPTION = new CommonException(303, "系统错误");

    public static final CommonException FILE_OPERATE_COMMON_EXCEPTION = new CommonException(330, "文件操作失败");

    public static final CommonException UNLOGIN_COMMON_EXCEPTION = new CommonException(390, "未登录，请先登录");
    public static final CommonException LOGIN_EXPIRE_COMMON_EXCEPTION = new CommonException(391, "登录过期，请重新登录");
    public static final CommonException UNPERMISSION_COMMON_EXCEPTION = new CommonException(392, "无权限访问");
}
